/**
 * Created by seeker910 on 13-12-25.
 */
Rsd.define('Rsd.control.WaitingBox', {
    extend: 'Rsd.container.Component',
    requires:['Rsd.control.LoadingBar'],
    xtype: 'waiting-box',
    bodyTagName:'nobr', 
    floating: true,
    modular: true,
    cls: 'x-waiting-box',
    message: '正在处理，请稍后...',
    layout: 'vbox',
    height: 32,
    width: 300,
    bodyCls:'x-text',
    header:{
        xtype: 'loading-bar',
        cls:'x-loading-bar',
        position:'bottom',
        space:0,
        //label:null,
        height:1
    },
    listeners:{
        'dblclick':{
            element:'dom',
            fn:function (sender,event) {
                if(this.key)
                {
                    Rsd.closeWaiting(this.key);
                }
                else
                {
                    this.close();
                }
               
            }
        }
    },
    /*
     * */
    constructor: function WaitingBox(config) {
        config = config || {};
        this.apply(config); 
    },
    /**
     * 
     */
    initComponentEx:function initComponentEx()
    {
        this.callParent();
        this.dom.setAttribute('key',this.key);
        this.body.element.innerHTML = this.message;
    },
    /*
     *
      *  */
    setMsg:function setMsg(msg) {
        this.setMessage(msg);
    },
    /*
    *
    * */
    setMessage:function setMessage(msg) {
        var me = this;
        me.message = msg;
        me.body.element.innerHTML = me.message;
    },
    /**
     * 
     */
    onAfterShow:function onAfterShow() {

        this.callParent(); 
        if( this.header.content &&  this.header.content.start)
        {
            this.header.content.start(4);
        }
       
    }
});